using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter08
{
	/// <summary>
	/// Example06: Crate Sliding Down a Ramp
	/// A 3.00 kg crate slides down a ramp. the ramp is 1.00m 
	/// in length and inclined at an angle of 30.0^{\circle}, 
	/// as shown in Figure 8.11. The crate starts from rest 
	/// at the top, experiences a constant friction force 
	/// of magnitude 5.00 N, and continues to move a short 
	/// distance on the horizontal floor after it leaves the ramp. 
	/// Use energy methods to determine the speed of the crate 
	/// at the bottom of the ramp.
	/// v_f = 2.54 m/s
	/// </summary>
	public class Example06
	{
		public Example06()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Length h = new L.Length();
			h.m = 1.0*Math.Sin(30.0*Math.PI/180.0);
			L.Mass m = new L.Mass();
			m.kg = 3.0;
            L.PotentialEnergy Ui = new L.PotentialEnergy();
			Ui.J = m.kg*L.Constant.AccelerationOfGravity*h.m;
			L.Work[] W = new L.Work[2];
			W[0] = new L.Work();
			W[0].J = Ui.J;
			W[1] = new L.Work();
			W[1].J = -5.0*1.0;
			L.KineticEnergy Ki = new L.KineticEnergy();
			Ki.J = 0.0;
			L.KineticEnergy Kf = new L.KineticEnergy();
			Kf.VariableQ = true;
			L.FundamentalLaw.WorkEnergyTheorem(Ki,W,Kf);
			L.Velocity vf = new L.Velocity(m,Kf);
			result += Convert.ToString(vf.mPERs);
		}
	}
}
